package fr.umlv.m2.jee.pmlv.persistence.ldapLink;

import java.io.Serializable;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import fr.umlv.m2.jee.pmlv.persistence.subject.Subject;

/**
 * Represents the link between a subject and the user
 * 
 * @author jenseric
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name="User__Subject")
public class UserSubject implements Serializable {
	/**The primary key of the entity. */
	@EmbeddedId
	private UserSubjectPK primaryKey;

	/**
	 * Sets the primary key of the entity
	 * @param primaryKey the primaryKey set.
	 */
	public void setPrimaryKey(UserSubjectPK primaryKey) {
		this.primaryKey = primaryKey;
	}

	/**
	 * Returns the primary key of the entity.
	 * @return the primary key of the entity.
	 */
	public UserSubjectPK getPrimaryKey() {
		return primaryKey;
	}
	
	/**
	 * Sets the user id concerned by the relation.
	 * @param uid the user id to be set.
	 */
	public void setUid(String uid) {
		primaryKey.setUid(uid);
	}

	/**
	 * Returns the user id concerned by the relation.
	 * @return the user id concerned by the relation.
	 */
	public String getUid() {
		return primaryKey.getUid();
	}
	
	/**
	 * Sets the subject concerned by the relation.
	 * @param subject the subject concerned by the relation to be set.
	 */
	public void setSubject(Subject subject) {
		primaryKey.setSubject(subject);
	}

	/**
	 * Returns the subject concerned by the relation.
	 * @return the subject concerned by the relation.
	 */	
	public Subject getSubject() {
		return primaryKey.getSubject();
	}

	/**
	 * Sets the role concerned by the relation.
	 * @param role the role of the user to be set.
	 */
	public void setRole(RoleInSubject role) {
		primaryKey.setRole(role);
	}

	/**
	 * Returns the role of the user in this relation.
	 * @return the role of the user in this relation.
	 */
	public RoleInSubject getRole() {
		return primaryKey.getRole();
	}

	/**
	 * Sets the year concerned by the relation.
	 * @param year the year concerned by the relation to be set.
	 */
	public void setYear(long year) {
		primaryKey.setYear(year);
	}

	/**
	 * Returns the year concerned by the relation.
	 * @return the year concerned by the relation.
	 */
	public long getYear() {
		return primaryKey.getYear();
	}


}
